<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{$pagetitle}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/global.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-header layuiadmin-card-header-auto">
            <div>
                <div class="header-left" style="width:70%">
                    <div class="layui-inline">
                        在信息管理中新增和修改的时候会将newstext字段的关键词加上url链接
                    </div>
                </div>
                <div class="header-right search-field" style="width:30%;">
                    <div class="layui-inline">
                        <a class="layui-btn iframe" data-width="70%" data-height="50%" href="{:url('add',['catid'=>$catid])}">添加</a>
                    </div>
                </div>
                <div class="clear"></div>
            </div>


        </div>

        <div class="layui-card-body">
            <form class="layui-form" action="{:url('updateSort')}" onsubmit="return save_form(this)">
                <table class="layui-table">
                    <thead>
                    <tr>
<!--                        <th width="3%"><input type="checkbox" value="0" class="checkall" lay-ignore></input></th>-->
                        <th width="5%">排序</th>
                        <th width="3%">ID</th>
                        <th width="10%">关键字</th>
                        <th width="10%">链接网址</th>
                        <th width="15%">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach $data as $key=>$v}
                    <tr>
                        <td style="text-align: center;" hidden><input type='checkbox' class="chekboxs" name="ids[]" lay-ignore value="{$v.id}"></td>
                        <td style="text-align: center;"><input type='text' value="{$v.sort}" name="sort[]" autocomplete="off" style="width:50px;text-align: center;"><input type='hidden' value="{$v.id}" name="id[]"></td>
                        <td style="text-align: center;">{$v.id}</td>
                        <td class="center tab-title">{$v.name}</td>
                        <td class="center">{$v.url}</td>
                        <td class="center">
                            <a href="{:url('update',array('id'=>$v['id']))}" target="_blank" class="layui-btn layui-btn-sm iframe" data-width="70%" data-height="50%"><i class="layui-icon">&#xe642;</i></a>
                            <a href="{:url('delete',array('id'=>$v['id']))}" class="layui-btn layui-btn-sm ajax_del"><i class="layui-icon">&#xe640;</i></a>
                        </td>

                    </tr>

                    {/foreach}
                    </tbody>
                </table>
                <div class="layui-inline">
                    <button class="layui-btn layui-btn-sm layuiadmin-btn-list">排序</button>
                </div>
                <div class="listpage">{$pagelist|raw}</div>
            </form>
        </div>

    </div>
</div>
<!--文件上传ajax调用的接口地址-->
<script>
    var upload_index="{:url('file/index')}";
    var upload_add="{:url('file/add')}";
    var upload_config="{:url('file/uploadConfig')}";
</script>
<script src="/static/admin/layui/layui.js"></script>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/globals.js"></script>
<!--文件上传的预览功能中中也需要用到我 fancybox plus start-->
<link rel="stylesheet" type="text/css" href="/static/fancybox3/jquery.fancybox.min.css" media="screen" />
<script type="text/javascript" src="/static/fancybox3/jquery.fancybox.min.js"></script>
<!--文件上传的预览功能中中也需要用到我 fancybox plus end-->
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function () {
        var $ = layui.$
            , admin = layui.admin
            , element = layui.element
            , form = layui.form;
        form.render(null, 'component-form-element');
        element.render('breadcrumb', 'breadcrumb');
        form.on('checkbox(status)', function(data){
            var checked=data.elem.checked;
            var status=checked?1:0;
            var id=data.value;
            ajax_del("{:url('setStatus')}?id="+id+"&status="+status,function(msg,data){
                layer.msg("设置成功");
            });
        });
    });
    //删除
    function this_delete(){
        layer.confirm("您确定要删除吗？",function(){
            $('.layui-form').attr('action','{:url('delete')}');
            $('.layui-form').submit();
        },function(){layer.closeAll();return false;});
    }
    $(".fancybox").fancybox();

</script>

</body>
</html>
